//
//  KZMessageOfMineCell.swift
//  BoyeStore
//
//  Created by 朱凯 on 2018/6/27.
//  Copyright © 2018年 itboye. All rights reserved.
//

import UIKit

class KZMessageOfMineCell: UITableViewCell {
    
    let badgePoint = UIView()
    let nameLabel = UILabel()
    let contentLabel = UILabel()
    let timeLabel = UILabel()

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension KZMessageOfMineCell {
    
    func setupUI() {
        
        nameLabel.numberOfLines = 1
        nameLabel.textColor = UIColor.black
        nameLabel.textAlignment = .left
        nameLabel.text = "商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称v"
        nameLabel.font = UIFont.systemFont(ofSize: 14)
        contentView.addSubview(nameLabel)
        nameLabel.snp.makeConstraints { (m) in
            m.left.equalTo(25)
            m.top.equalTo(15)
        }
        
        contentLabel.numberOfLines = 0
        contentLabel.textColor = UIColor.lightGray
        contentLabel.textAlignment = .left
        contentLabel.text = "[验收提醒][验收提醒][验收提醒][验收提醒][验收提醒][验收提醒][验收提醒][验收提醒][验收提醒][验收提醒]"
        contentLabel.font = UIFont.systemFont(ofSize: 12)
        contentView.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { (m) in
            m.left.equalTo(nameLabel)
            m.top.equalTo(nameLabel.snp.bottom).offset(10)
            m.right.equalTo(-10)
        }
        
        timeLabel.textColor = UIColor.lightGray
        timeLabel.textAlignment = .right
        timeLabel.text = "18:02"
        timeLabel.font = UIFont.systemFont(ofSize: 12)
        contentView.addSubview(timeLabel)
        timeLabel.snp.makeConstraints { (m) in
            m.right.equalTo(contentLabel)
            m.top.equalTo(nameLabel)
            m.left.greaterThanOrEqualTo(nameLabel.snp.right).offset(10)
        }
        
        let line = UIView()
        line.backgroundColor = kLineColor
        contentView.addSubview(line)
        line.snp.makeConstraints { (m) in
            m.top.equalTo(contentLabel.snp.bottom).offset(10)
            m.left.right.equalTo(0)
            m.height.equalTo(0.5)
            m.bottom.equalTo(0)
        }
        
        contentView.addSubview(badgePoint)
        badgePoint.layer.cornerRadius = 2.5
        badgePoint.backgroundColor = kThemeColor
        badgePoint.snp.makeConstraints { (m) in
            m.width.height.equalTo(5)
            m.centerY.equalTo(timeLabel)
            m.centerX.equalTo(25.0/2)
        }
    }
}
